package com.example.springbootjpasqllogdemo.repository;

import com.example.springbootjpasqllogdemo.domain.UserRecord;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.domain.Example;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * 系统用户档案表 持久层
 *
 * @author Lv
 * @date 2022/11/4
 */
@Repository
public interface UserRecordRepository extends JpaRepository<UserRecord, Integer>, JpaSpecificationExecutor<UserRecord>, QuerydslPredicateExecutor<UserRecord> {
    /**
     * 通过id获取
     *
     * @param id 系统用户档案对象id
     * @return
     */
    UserRecord getById(Integer id);

    /**
     * 通过名称和专业查找
     *
     * @param name       名称
     * @param profession 专业
     * @return
     */
    List<UserRecord> findAllByNameLikeAndProfession(String name, String profession);


//    @Modifying
//    @Query("update user_record set name = '', phone = '', email = '', profession = '', age = '', gender = '', status = '', createtime = '' where id = 39;")
//    int updateRecord()
}